package com.dgh.school.common;


import java.util.HashMap;

/**
 * 统一数据格式的封装
 */

public class R extends HashMap<String,Object> {

    public static R newInstance(int code,String msg){
        R r = new R();
        r.put("code",code);
        r.put("msg",msg);
        return r;
    }

    public static R ok(){
        R r = new R();
        r.put("code",200);
        r.put("msg","ok");
        return r;
    }
    public static R error(){
        R r = new R();
        r.put("code",500);
        r.put("msg","error");
        return r;
    }
    public R setDate(String key,Object value){
        put(key,value);
        return this;

    }

}
